package huoye.shops.widget;


import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.codeideology.android.widget.ios.dialog.base.BaseDialog;

import huoye.shops.R;
import huoye.shops.huoye.operation.widget.HintTitleDialog;


/**
 * 升级对话框
 */
public class UpdateDialog extends BaseDialog<UpdateDialog> {



    private Context mContext;
    private TextView tvVerno;
    private TextView tvFileSeize;
    private TextView tvMessage;
    private TextView tvUpdate;


    public UpdateDialog(Context context) {
        super(context);
        this.mContext = context;
    }

    @Override
    public View onCreateView() {
        widthScale(0.80f);
        View inflate = View.inflate(context, R.layout.update_dialog, null);
        tvVerno = (TextView) inflate.findViewById(R.id.dialog_update_tv_verno);
        tvFileSeize = (TextView) inflate.findViewById(R.id.dialog_update_tv_file_seize);
        tvMessage = (TextView) inflate.findViewById(R.id.dialog_update_tv_message);
        tvUpdate = (TextView) inflate.findViewById(R.id.dialog_update_tv_update);

        return inflate;
    }

    @Override
    public void setUiBeforShow() {
        tvUpdate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                listener.onUpdateClick();
                dismiss();
            }
        });

    }


    public void setDialogContent(String update,String fileSeize,String message){
        tvVerno.setText("V"+update);
        tvFileSeize.setText(fileSeize);
        tvMessage.setText(message.replace("、","\n"));


    }

    public interface OnUpdateListener {
        void onUpdateClick();

    }
    public void setOnUpdateListener(OnUpdateListener onListener) {
        this.listener = onListener;
    }

    private OnUpdateListener listener;

}
